<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MarkItDown - 微软开源的多格式转Markdown工具</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.6;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
        }
        .code-block {
            background-color: #1e293b;
            color: #e2e8f0;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .section-divider {
            height: 2px;
            background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 1) 50%, rgba(37, 99, 235, 0.1) 100%);
        }
        .drop-cap::first-letter {
            font-size: 3.5rem;
            font-weight: bold;
            float: left;
            line-height: 0.8;
            margin-right: 0.5rem;
            color: #2563eb;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">MarkItDown</h1>
                    <h2 class="text-2xl md:text-3xl font-semibold mb-6">微软开源的多格式转Markdown工具</h2>
                    <p class="text-lg mb-8 opacity-90">将PDF、Office文档、图像、音频等转换为结构化的Markdown，优化LLM数据处理和文档分析流程。</p>
                    <div class="flex flex-wrap gap-4">
                        <a href="https://github.com/microsoft/markitdown" 
                           class="bg-white text-blue-700 hover:bg-gray-100 px-6 py-3 rounded-lg font-medium transition-all duration-300 flex items-center">
                            <i class="fab fa-github mr-2"></i> GitHub仓库
                        </a>
                        <a href="#installation" 
                           class="bg-transparent border-2 border-white hover:bg-white hover:text-blue-700 px-6 py-3 rounded-lg font-medium transition-all duration-300">
                            立即开始
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white/10 backdrop-blur-sm rounded-xl p-6 border border-white/20">
                        <div class="code-block p-6">
                            <pre class="text-sm md:text-base"><code class="language-bash">$ pip install 'markitdown[all]'
$ markitdown input.docx > output.md</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Problem Section -->
    <section class="py-16 px-4 bg-white">
        <div class="max-w-4xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">它能解决什么问题</h2>
            <div class="drop-cap text-lg text-gray-700 mb-8">
                处理多种文件格式时，开发者常因格式不统一、结构丢失或转换复杂而耗费时间。PDF 提取常需 OCR，Office 文档转文本易丢失格式，图像和音频处理更需额外工具。MarkItDown 通过统一转换为 Markdown 解决这些问题，简化数据准备。
            </div>
            <div class="bg-blue-50 border-l-4 border-blue-500 p-6 rounded-r-lg">
                <p class="text-blue-800 font-medium flex items-start">
                    <i class="fas fa-question-circle text-blue-500 mr-3 mt-1"></i>
                    你是否也为文档转换效率低而苦恼？
                </p>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 px-4 bg-gray-50">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">核心功能概述</h2>
            <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
                <div class="feature-card bg-white p-6 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-600 text-3xl mb-4">
                        <i class="fas fa-file-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">多格式支持</h3>
                    <p class="text-gray-600">转换 PDF、DOCX、XLSX、PPTX、HTML、图像、音频等为 Markdown</p>
                </div>
                <div class="feature-card bg-white p-6 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-600 text-3xl mb-4">
                        <i class="fas fa-project-diagram"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">结构化提取</h3>
                    <p class="text-gray-600">保留文档的标题、列表、表格等结构，优化 LLM 分析</p>
                </div>
                <div class="feature-card bg-white p-6 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-600 text-3xl mb-4">
                        <i class="fas fa-images"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">多模态处理</h3>
                    <p class="text-gray-600">通过 OCR 和语音识别提取图像和音频内容</p>
                </div>
                <div class="feature-card bg-white p-6 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-600 text-3xl mb-4">
                        <i class="fas fa-puzzle-piece"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">插件扩展</h3>
                    <p class="text-gray-600">支持第三方插件，允许定制转换逻辑</p>
                </div>
                <div class="feature-card bg-white p-6 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-600 text-3xl mb-4">
                        <i class="fas fa-terminal"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">命令行与 API</h3>
                    <p class="text-gray-600">提供 CLI 和 Python API，适配多种工作流</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Use Cases Section -->
    <section class="py-16 px-4 bg-white">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">使用场景</h2>
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-gray-50 p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-robot text-blue-600 mr-2"></i> LLM 数据准备
                    </h3>
                    <p class="text-gray-600">将公司报告转为 Markdown，供 LLM 微调或 RAG 系统使用</p>
                </div>
                <div class="bg-gray-50 p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-book text-blue-600 mr-2"></i> 知识库构建
                    </h3>
                    <p class="text-gray-600">转换团队文档为统一 Markdown 格式，创建可搜索知识库</p>
                </div>
                <div class="bg-gray-50 p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-chart-line text-blue-600 mr-2"></i> 内容分析
                    </h3>
                    <p class="text-gray-600">将 PPT 和音频转为 Markdown，提取关键信息</p>
                </div>
                <div class="bg-gray-50 p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-lightbulb text-blue-600 mr-2"></i> 你的需求
                    </h3>
                    <p class="text-gray-600">你能用它优化哪些数据流程？</p>
                </div>
            </div>
            
            <div class="section-divider my-12"></div>
            
            <div class="bg-blue-50 border border-blue-200 rounded-xl p-6">
                <h3 class="text-xl font-semibold mb-4 text-blue-800">优势与特色</h3>
                <ul class="list-disc pl-5 text-gray-700 space-y-2">
                    <li>支持广泛格式，结构保留优于 textract</li>
                    <li>插件机制增强扩展性</li>
                    <li>MIT 许可证开源，社区活跃（超 50k GitHub 星）</li>
                    <li>注意：PDF 需预先 OCR，图像处理依赖外部 LLM，可能增加配置复杂性</li>
                </ul>
            </div>
        </div>
    </section>

    <!-- Installation Section -->
    <section id="installation" class="py-16 px-4 bg-gray-50">
        <div class="max-w-4xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">上手指南</h2>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-download text-blue-600 mr-2"></i> 安装
                </h3>
                <div class="code-block p-4 mb-6">
                    <pre><code class="language-bash">pip install 'markitdown[all]'</code></pre>
                </div>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-exchange-alt text-blue-600 mr-2"></i> 转换文件
                </h3>
                <div class="code-block p-4 mb-6">
                    <pre><code class="language-bash">markitdown input.docx > output.md</code></pre>
                </div>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-code text-blue-600 mr-2"></i> 代码使用
                </h3>
                <div class="code-block p-4 mb-6">
                    <pre><code class="language-python">from markitdown import MarkItDown
md = MarkItDown()
print(md.convert("test.pdf").markdown)</code></pre>
                </div>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-plug text-blue-600 mr-2"></i> 探索插件
                </h3>
                <p class="text-gray-700 mb-4">搜索 <span class="bg-gray-200 px-2 py-1 rounded">#markitdown-plugin</span> 添加扩展</p>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fab fa-docker text-blue-600 mr-2"></i> Docker 使用
                </h3>
                <div class="code-block p-4">
                    <pre><code class="language-bash">docker build -t markitdown:latest .
docker run --rm -i markitdown:latest < ~/your-file.pdf > output.md</code></pre>
                </div>
            </div>
        </div>
    </section>

    <!-- Python API Section -->
    <section class="py-16 px-4 bg-white">
        <div class="max-w-4xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">Python API</h2>
            
            <div class="mb-10">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">Python 中的基本用法</h3>
                <div class="code-block p-4">
                    <pre><code class="language-python">from markitdown import MarkItDown

md = MarkItDown(enable_plugins=False) # Set to True to enable plugins
result = md.convert("test.xlsx")
print(result.text_content)</code></pre>
                </div>
            </div>
            
            <div class="mb-10">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">Python 中的文档智能转换</h3>
                <div class="code-block p-4">
                    <pre><code class="language-python">from markitdown import MarkItDown

md = MarkItDown(docintel_endpoint="&lt;document_intelligence_endpoint&gt;")
result = md.convert("test.pdf")
print(result.text_content)</code></pre>
                </div>
            </div>
            
            <div class="mb-10">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">使用大型语言模型进行图像描述</h3>
                <p class="text-gray-700 mb-4">要使用大型语言模型进行图像描述，请提供 <span class="bg-gray-200 px-2 py-1 rounded">llm_client</span> 和 <span class="bg-gray-200 px-2 py-1 rounded">llm_model</span></p>
                <div class="code-block p-4">
                    <pre><code class="language-python">from markitdown import MarkItDown
from openai import OpenAI

client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
result = md.convert("example.jpg")
print(result.text_content)</code></pre>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization Section -->
    <section class="py-16 px-4 bg-gray-50">
        <div class="max-w-4xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">MarkItDown 工作流程</h2>
            <div class="mermaid">
                graph LR
                A[输入文件] --> B{判断文件类型}
                B -->|PDF| C[OCR/文档智能处理]
                B -->|Office文档| D[提取结构化内容]
                B -->|图像| E[LLM描述/OCR]
                B -->|音频| F[语音转文本]
                C --> G[转换为Markdown]
                D --> G
                E --> G
                F --> G
                G --> H[输出Markdown]
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>